#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include "sstream"
#include "Quantity.h"
#include "FormatLength.h"


USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(LengthUnit)
{
	TEST(3 miles should be equal to 3 miles)
	{
		ASSERT_TRUE(LENGTH(3, MILE) == LENGTH(3, MILE));
	}
	TEST(3 miles should be equal to 4 miles)
	{
		ASSERT_FALSE(LENGTH(3,MILE) == LENGTH(4,MILE));
	}
	TEST(3 yards should be equal to 3 yards)
	{
		ASSERT_TRUE(LENGTH(3,YARD) == LENGTH(3,YARD));
	}
	TEST(3 yards should be equal to 4 yards)
	{
		ASSERT_FALSE(LENGTH(3,YARD) == LENGTH(4,YARD));
	}
	TEST(3 foot should be equal to 3 foot)
	{
		ASSERT_TRUE(LENGTH(3,FEET) == LENGTH(3,FEET));
	}
	TEST(3 foot should be equal to 4 foot)
	{
		ASSERT_FALSE(LENGTH(3,FEET) == LENGTH(4,FEET));
	}
	TEST(3 inches should be equal to 3 inches)
	{
		ASSERT_TRUE(LENGTH(3,INCH) == LENGTH(3,INCH));
	}
	TEST(3 inches should be equal to 4 inches)
	{
		ASSERT_FALSE(LENGTH(3,INCH) == LENGTH(4,INCH));
	}
	TEST(1760 yard should be equal to 1 mile)
	{
		ASSERT_TRUE(LENGTH(1760,YARD) == LENGTH(1,MILE));
	}
        TEST(1761 yard should be not equal to 1 mile)
	{
		ASSERT_FALSE(LENGTH(1761,YARD) == LENGTH(1,MILE));
	}

        TEST(1 yard should be equal to 3 feet)
	{
		ASSERT_TRUE(LENGTH(1,YARD) == LENGTH(3,FEET));
	}

        TEST(1 yard should be not equal to 4 feet)
	{
		ASSERT_FALSE(LENGTH(1,YARD) == LENGTH(4,FEET));
	}

        TEST(1 feet should be equal to 12 inch)
	{
		ASSERT_TRUE(LENGTH(1,FEET) == LENGTH(12,INCH));
	}

        TEST(1 feet should be not equal to 13 feet)
	{
		ASSERT_FALSE(LENGTH(1,FEET) == LENGTH(13,INCH));
	}


       TEST(11 inch plus 13 inch equal 2 feet)
	{
		ASSERT_TRUE(LENGTH(2,FEET) == LENGTH(13,INCH) + LENGTH(11,INCH));
	}

       TEST(2 feet plus 4 feet equal 2 yard)
	{
		ASSERT_TRUE(LENGTH(2,YARD) == LENGTH(2,FEET) + LENGTH(4,FEET));
	}
       TEST(2 feet plus 5 feet not equal 2 yard)
	{
		ASSERT_FALSE(LENGTH(2,YARD) == LENGTH(2,FEET) + LENGTH(5,FEET));
	}

        TEST(3 feet plus 36 INCH equal 2 yard)
	{
		ASSERT_TRUE(LENGTH(2,YARD) == LENGTH(3,FEET) + LENGTH(36,INCH));
	}
       TEST(3 feet plus 37 INCH not equal 2 yard)
	{
 		ASSERT_FALSE(LENGTH(2,YARD) == LENGTH(37,INCH) + LENGTH(3,FEET));
	}    
       TEST(35 INCH should be 2 FEET 11 INCH)
	{
 		stringstream stringExpected("2 FEET 11 INCH \r\n");
                stringstream sStringOs;

		FormatLength(LENGTH(35,INCH)).outputFormatedLength(sStringOs);
		ASSERT_TRUE(stringExpected.str() == sStringOs.str());
	}
       TEST(38 INCH should be 1 YARD 2 INCH)
	{
 		stringstream stringExpected("1 YARD 2 INCH \r\n");
                stringstream sStringOs;

		FormatLength(LENGTH(38,INCH)).outputFormatedLength(sStringOs);
		ASSERT_TRUE(stringExpected.str() == sStringOs.str());
	}    
       TEST(48 INCH should be 1 YARD 1 FEET)
	{
 		stringstream stringExpected("1 YARD 1 FEET \r\n");
                stringstream sStringOs;

		FormatLength(LENGTH(48,INCH)).outputFormatedLength(sStringOs);
		ASSERT_TRUE(stringExpected.str() == sStringOs.str());
	}     
       TEST(1781 YARD should be 1 MILE 21 YARD)
	{
 		stringstream stringExpected("1 MILE 21 YARD \r\n");
                stringstream sStringOs;

		FormatLength(LENGTH(1781,YARD)).outputFormatedLength(sStringOs);
		ASSERT_TRUE(stringExpected.str() == sStringOs.str());
	}           
};
